/*===========================================================
 
 .---=||||[ B L O O D Y ]|||||=====================----------....
 |                                                              |
 |    THE  M O S T   B L O O D Y  GAME EVER!                    |
 |                                                              |
 |    bloody harvest is coming... soon,                         |
 |                                              heil Satan!     |
 !                                                              !
 .                                                              ,
  ~~~~-------------================================|||||||||==-~




 Name-Space: {core, logic, editor}
 Module: {draw, coll, scgr, ...}
 Class: <name of class>
 Last modification:  <author>, <time>

 TODO:
 <-------- todo #1 ---------->
 <-------- todo #2 ---------->
 <-------- todo #3 ---------->
        ............
 <-------- todo #n ---------->

 FIX:
 <-------- fix #1 ----------->
 <-------- fix #1 ----------->
         ..........
 <-------- fix #n ----------->




 
 
 ============================================================*/
#include "core/evnt/Keyboard.h"

using namespace std;

namespace core
{
	namespace evnt
	{
		
		
	
		Keyboard::Keyboard()
		{
		}
		
		Keyboard::~Keyboard()
		{
		}
		
		bool Keyboard::isKeyPressed(SDLKey key) const
		{
			set<SDLKey>::const_iterator it = keylist.find(key);
			return keylist.end() != it;
		}
		
		void Keyboard::processEvents(const SDL_KeyboardEvent& event)
		{
			if (event.type == SDL_KEYDOWN)
			{
				keylist.insert(event.keysym.sym);
			}
			else if (event.type == SDL_KEYUP)
			{
				/*set<SDLKey>::iterator it = keylist.find(event.keysym.sym);
				if (it != keylist.end())*/
					keylist.erase(event.keysym.sym);
			}
		}
	}
}
